<!DOCTYPE html>
<title>Tests mouse interactions on a non-custom composited root scrollbar thumb.</title>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../resources/gesture-util.js"></script>
<script src="../../../resources/scrollbar-util.js"></script>
<body style="height: 1000px; width: 1000px">
<script>
if (window.internals)
    internals.settings.setScrollAnimatorEnabled(false);

window.onload = () => {
  const TRACK_WIDTH = calculateScrollbarThickness();
  const BUTTON_WIDTH = TRACK_WIDTH;

  promise_test (async () => {
    await waitForCompositorCommit();
    resetScrollOffset(document.scrollingElement);

    // Testing the vertical scrollbar thumb.
    let x = window.innerWidth - TRACK_WIDTH / 2;
    let y = BUTTON_WIDTH + 10;

    await mouseMoveTo(x, y);
    await mouseDownAt(x, y);
    assert_equals(window.scrollY, 0, "Mousedown on vertical scrollbar thumb is not expected to scroll.");

    await mouseMoveTo(x, y-10);
    assert_equals(window.scrollY, 0, "Vertical thumb drag beyond the track should not cause a scroll.");

    await mouseMoveTo(x, y);
    assert_equals(window.scrollY, 0, "Vertical thumb drag beyond the track and back should not cause a scroll.");
    await mouseUpAt(x, y);
  }, "Test thumb drags beyond scrollbar track.");
}
</script>
</body>
